//package io.github.novaframe.config.metrics;
//
//import com.codahale.metrics.MetricRegistry;
//import com.codahale.metrics.graphite.Graphite;
//import com.codahale.metrics.graphite.GraphiteReporter;
//import io.github.novaframe.config.NovaframeProperties;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
//import org.springframework.context.annotation.Configuration;
//
//import java.net.InetSocketAddress;
//import java.util.concurrent.TimeUnit;
//
///**
// * Created by Locki on 8/15/2017.
// */
//
//@Configuration
//@ConditionalOnClass(Graphite.class)
//public class GraphiteRegistry {
//
//    private final Logger log = LoggerFactory.getLogger(GraphiteRegistry.class);
//
//    private final NovaframeProperties properties;
//
//    public GraphiteRegistry(MetricRegistry metricRegistry, NovaframeProperties properties) {
//        this.properties = properties;
//        if (this.
//                properties.getMetrics().getGraphite().isEnabled()) {
//            log.info("Initializing Metrics Graphite reporting");
//            String graphiteHost = properties.getMetrics().getGraphite().getHost();
//            Integer graphitePort = properties.getMetrics().getGraphite().getPort();
//            String graphitePrefix = properties.getMetrics().getGraphite().getPrefix();
//            Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, graphitePort));
//            GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry)
//                    .convertRatesTo(TimeUnit.SECONDS)
//                    .convertDurationsTo(TimeUnit.MILLISECONDS)
//                    .prefixedWith(graphitePrefix)
//                    .build(graphite);
//            graphiteReporter.start(1, TimeUnit.MINUTES);
//        }
//    }
//}
